local qingbei = fk.CreateSkill {
  name = "anche__qingbei",
}

Fk:loadTranslationTable{
  ["anche__qingbei"] = "擎北",
  [":anche__qingbei"] = "每回合开始时，你可以摸两张牌并弃置两张牌，然后你可以使用被弃置的非装备牌(无距离限制)，若如此做，此回合你无法使用与弃置牌花色相同的牌",
  ["@anche__qingbei_s-turn"] = "无法使用 黑桃",
  ["@anche__qingbei_c-turn"] = "无法使用 梅花",
  ["@anche__qingbei_h-turn"] = "无法使用 红桃",
  ["@anche__qingbei_d-turn"] = "无法使用 方块",
  ["$anche__qingbei1"] = "",
  ["$anche__qingbei2"] = "",
}

qingbei:addEffect(fk.TurnStart, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(qingbei.name)
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    player:drawCards(2,qingbei.name)
    local card= room:askToChooseCards(player, {
        target = player,
        min = 2,
        max = 2,
        flag = "he",
        skill_name = qingbei.name
    })
    room:throwCard(card, qingbei.name, player, player)
    for _, id in ipairs(card) do
        if Fk:getCardById(id).type ~= Card.TypeEquip then
            local use = room:askToUseRealCard(player, {
                pattern = { id },
                skill_name = qingbei.name,
                extra_data = {
                bypass_times = true,
                bypass_distances = true,
                expand_pile = { id },
                extraUse = true,
                },
            })
            if use then
                if player.dead  then break end
                if  Fk:getCardById(id).suit == Card.Spade then
                    room:setPlayerMark(player, "@anche__qingbei_s-turn",1)
                elseif Fk:getCardById(id).suit == Card.Club then
                    room:setPlayerMark(player, "@anche__qingbei_c-turn",1)
                elseif Fk:getCardById(id).suit == Card.Heart then
                    room:setPlayerMark(player, "@anche__qingbei_h-turn",1)
                else
                    room:setPlayerMark(player, "@anche__qingbei_d-turn",1)
                end
            end
        end
        player:broadcastSkillInvoke(qingbei.name, 1)
        player:broadcastSkillInvoke(qingbei.name, 2)
     end
  end,
})


qingbei:addEffect("prohibit", {
  prohibit_use = function(self, player, card)
    if player:getMark("@anche__qingbei_s-turn") > 0 then
        return card and card.suit == Card.Spade
    end
    if player:getMark("@anche__qingbei_c-turn") > 0 then
        return card and card.suit == Card.Club
    end
    if player:getMark("@anche__qingbei_h-turn") > 0 then
        return card and card.suit == Card.Heart
    end
    if player:getMark("@anche__qingbei_d-turn") > 0 then
        return card and card.suit == Card.Diamond
    end
  end,
})

return qingbei
